﻿using Smart.Admin.Domain.Model.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging.Debug;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Smart.Admin.Domain.Repository
{
    /// <summary>
    /// 上下文
    /// </summary>
    public class SmartAdminDbContext : DbContext
    {

        /// <summary>
        /// 日志工厂
        /// </summary>
        public static readonly LoggerFactory MyLoggerFactory = new LoggerFactory(new[] {
            new DebugLoggerProvider()
        });

        public SmartAdminDbContext(DbContextOptions<SmartAdminDbContext> options) : base(options)
        {

        }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
            optionsBuilder.UseLoggerFactory(MyLoggerFactory);
        }

        public DbSet<EmployeeEntity> Employee { get; set; }

        public DbSet<MenuEntity> Menu { get; set; }

        public DbSet<RoleEntity> Role { get; set; }

        public DbSet<RoleMenuEntity> RoleMenu { get; set; }

        public DbSet<RoleEmployeeEntity> RoleEmployee { get; set; }

        public DbSet<DepartmentEntity> Department { get; set; }

        public DbSet<StoreEntity> Store { get; set; }

        public DbSet<NoticeEntity> Notice { get; set; }

        public DbSet<HelpDocEntity> HelpDoc { get; set; }

        public DbSet<HelpDocCatalogEntity> HelpDocCatalog { get; set; }
    }
}
